//导入vue-router包
import VueRouter from 'vue-router'

//导入路由组件
import HomeContainer from './components/tabber/HomeContainer.vue'
import MemberContainer from './components/tabber/MemberContainer.vue'
import SearchContainer from './components/tabber/SearchContainer.vue'
import ShopcarContainer from './components/tabber/ShopcarContainer.vue'
//导入newslist组件
import NewsList from './components/news/NewsList.vue'
//导入newsinfo组件
import Newsinfo from './components/news/Newsinfo.vue'
//导入图片列表PhotoList组件
import PhotoList from './components/photos/PhotoList.vue'
//导入图片详情photoinfo组件
import PhotoInfo from './components/photos/photoinfo.vue'
//导入商品列表GoodsList.vue组件
import GoodsList from './components/goods/GoodsList.vue'
//导入商品详情Goodsinfo.vue组件
import Goodsinfo from './components/goods/GodsInfo.vue'
//导入商品图文介绍组件
import GoodsDesc from './components/goods/GoodsDesc.vue'
//导入商品评论组件
import GoodsComment from './components/goods/GoodsComment.vue'
//导入留言反馈组件
import letter from './components/letter/letter.vue'
//导入视频专区组件
import video from './components/video/video.vue'
//导入联系我们组件
import  contact from './components/contact/contact.vue'

//3.创建路由对象
var routerObj = new VueRouter({
    routes: [//配置路由规则
        {
            path: '/', redirect: '/home'  //重定向
        },
        {//首页
            path: '/home', component: HomeContainer
        },
        {//会员
            path: '/member', component: MemberContainer
        },
        {//搜索
            path: '/search', component: SearchContainer
        },
        {//购物车
            path: '/shopcar', component: ShopcarContainer
        },
        {//新闻列表
            path: '/home/newslist', component: NewsList
        },
        {//新闻详情
            //这里写/:id 表示这是一个参数
            path: '/home/newsinfo/:id', component: Newsinfo
        },
        {//图文列表
            path: '/home/photolist', component: PhotoList
        },
        {//图文详情
            path: '/home/photoinfo/:id', component: PhotoInfo
        },
        {//商品列表
            path: '/home/goodslist', component: GoodsList

        },
        {//商品详情
            path: '/home/goodsinfo/:id', component: Goodsinfo,
            name: 'goodsinfo'
        },
        {//商品图文介绍
            path: '/home/goodsinfo/goodsdesc/:id', name: 'goodsdesc', component: GoodsDesc
        },
        {//商品评论
            path: '/home/goodsinfo/goodscomment/:id', name: 'goodscomment', component: GoodsComment
        },
        {//留言反馈
            path: '/home/letter', component: letter
        },
          {//视频专区
            path: '/home/video', component: video
        },
        {//联系我们
            path: '/home/contact', component: contact
        }
    ],
    linkActiveClass: 'mui-active'//这是覆盖默认的路由高亮的类，默认的类叫做router-link-active
})
//把路由对象暴露出去
export default routerObj